package xiaohu.day3.HJ36;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;

public class Main2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextLine()) {
            String key = scanner.nextLine();
            char[] chars = scanner.nextLine().toLowerCase().toCharArray();
            ArrayList<Character> characters = new ArrayList<>();
            //去重
            for (int i = 0; i < key.length(); i++) {
                if (!characters.contains(key.charAt(i))) {
                    characters.add(key.charAt(i));
                }
            }
            //添加剩下的字母
            for (char i = 'a'; i <= 'z'; i++) {
                if (!characters.contains(i)) {
                    characters.add(i);
                }
            }

            char[] charArry =new char[characters.size()];
            int index = 0;
            for (Character character : characters) {
                charArry[index]=character;
                index++;
            }
            StringBuilder stringBuilder = new StringBuilder();
            //对字符串进行加密
            for (int i = 0; i < chars.length; i++) {
                stringBuilder.append(charArry[chars[i]-'a']);
            }
            System.out.println(stringBuilder.toString());
        }
    }
}
